﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>

<script type="text/javascript">

    function submit() {
        var user_name = $("#user_name").val();
        var login_id = $("#login_id").val();
        var login_password = $("#login_password").val();
        var login_password2 = $("#login_password2").val();
        var dept_id = $("#dept_id").val();
        var duty_id = $("#duty_id").val();
        if ("" == user_name) {
            alert("用户名为空！");
            return false;
        }
        if ("" == login_id) {
            alert("登陆名为空！");
            return false;
        }
        if ("" == login_password) {
            alert("密码为空！");
            return false;
        }
        if ("" == dept_id) {
            alert("请选择部门！");
            return false;
        }
        if ("" == dept_id) {
            alert("请选择职位！");
            return false;
        }
        if (login_password != login_password2) {
            alert("密码不一致,请确认!");
            return false;
        }

        $.ajax({
            url: "/Register/DoAddUser",
            data: { "login_id": login_id, "user_name": user_name, "login_password": login_password, "dept_id": dept_id, "duty_id": duty_id },
            type: "POST",
            sucess: submitresult
        });
    };

    function submitresult(data) {
        alert(data);
    };
</script>

<div>
    用户名：<input type="text" id="login_id" /><br />
    姓名:<input type="text" id="user_name" /><br />
    密码:<input type="password" id="login_password" /><br />
    密码确认:<input type="password" id="login_password2" /><br />
    <p>
        部门：<%=Html.DropDownList("dept_id",ViewData["list_dept"] as List<SelectListItem>,"--请选择--") %>
    </p>
    <p>
        职务：<%=Html.DropDownList("duty_id",ViewData["list_duty"] as List<SelectListItem>,"--请选择--") %>
    </p>
    <input type="button" value="提交" onclick="return submit()" />
</div>
